import _thread
import threading as thread

def sayHello(name):
    print("hello "+name)

#创建线程

_thread.start_new_thread(sayHello,("线程1",))

class MyThread(thread.Thread):

    def __init__(self, name):
        thread.Thread.__init__(self)
        self.name=name

    def run(self):
        print("hello "+thread.Thread.getName(self))

if __name__=="__main__":
    t1=MyThread("t-1")
    t2=MyThread("t-2")
    t1.start()
    t2.start()
    